Building RESTful Web Services with .NET Core by Gaurav Aroraa Tadit Dash
Author:Gaurav Aroraa,Tadit Dash [Gaurav Aroraa]
Language: eng
Format: epub
Tags: COM051310 - COMPUTERS / Programming Languages / C#, COM051470 - COMPUTERS / Programming Languages / ASP .NET, COM060180 - COMPUTERS / Web / Web Services and APIs
Publisher: Packt Publishing
Published: 2018-05-30T10:43:36+00:00
Use
The Use method adds a delegate to the application request pipelines. Look at the following screenshot for the signature of this method:
Signature of Use method
As we discussed in the previous section, the middleware methods can short circuit the request pipeline or pass the request to the next delegate.
Short-circuiting a request is nothing but ending a request.
Look at the following code for the Use method:
public void Configure(IApplicationBuilder app)
{
async Task Middleware(HttpContext context, Func<Task> next)
{
//other stuff
await next.Invoke();
//other stuff
}
app.Use(Middleware);
}
In the preceding code, I have tried to explain the dummy implementation of the Use method with the help of a local function. Here, you can see that Middleware is invoking or passing the request to the next delegate, before or after await next.Invoke();. You can write/implement other code phrases, but these phrases should not send responses to the client, such as those that write output, produce the 404 status, and so on.
Local functions are the methods that are declared within a method and can be called within the scope of the method itself. These methods can only be used by another method.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Content Management | Programming |
User Experience & Usability | User Generated Content |
Web Design | Web Marketing |
Web Services | Website Analytics |
Hello! Python by Anthony Briggs(9916)
The Mikado Method by Ola Ellnestam Daniel Brolund(9779)
Dependency Injection in .NET by Mark Seemann(9340)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7781)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Svelte with Test-Driven Development by Daniel Irvine(7175)
Test-Driven Development with PHP 8 by Rainier Sarabia(6903)
Layered Design for Ruby on Rails Applications by Dementyev Vladimir;(6772)
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(6534)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6419)
Web Development with Django by Ben Shaw Saurabh Badhwar(6235)
React Application Architecture for Production by Alan Alickovic(5960)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(5807)
Kotlin in Action by Dmitry Jemerov(5066)
Audition by Ryu Murakami(4583)
Software Architecture for Web Developers by Mihaela Roxana Ghidersa(4457)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4317)
Accelerating Server-Side Development with Fastify by Manuel Spigolon Maksim Sinik & Matteo Collina(4306)
Functional Programming in JavaScript by Mantyla Dan(4038)
